﻿/*
    Copyright 2010, 2011 Eric Wong
	contact@optimalcycling.com
	http://www.optimalcycling.com
	Optimal Cycling - Advanced power pacing program for cyclists
	
	This file is part of Optimal Cycling.

    Optimal Cycling is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Optimal Cycling is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Optimal Cycling.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.IO;
using System.Runtime.InteropServices;
using Cloo;

namespace OptimalCycling
{
    #region Alias

    using sizeT = System.UInt32;
    using size_array = System.UInt32;

    // Allow us to easily switch between floats and double values
#if REAL_IS_DOUBLE
    using real = System.Double;
    using real2 = Vector2d;
    using real4 = Vector4d;
    using real8 = Vector8d;
#else
    using real = System.Single;
    using real2 = Vector2;
    using real4 = Vector4;
    using real8 = Vector8;
#endif

    #endregion

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct uint2
    {
        public uint X;
        public uint Y;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct uint4
    {
        public uint X;
        public uint Y;
        public uint Z;
        public uint W;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct ulong4
    {
        public ulong X;
        public ulong Y;
        public ulong Z;
        public ulong W;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct Vector2
    {
        public float X;
        public float Y;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct Vector4
    {
        public float X;
        public float Y;
        public float Z;
        public float W;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct Vector2d
    {
        public real X;
        public real Y;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct Vector4d
    {
        public double X;
        public double Y;
        public double Z;
        public double W;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct Vector8
    {
        public float s0;
        public float s1;
        public float s2;
        public float s3;
        public float s4;
        public float s5;
        public float s6;
        public float s7;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 8)]
    [Serializable()]
    public struct Vector8d
    {
        public double s0;
        public double s1;
        public double s2;
        public double s3;
        public double s4;
        public double s5;
        public double s6;
        public double s7;
    }
}